<?php
$str=file_get_contents('http://dianying.114la.com/?kz');
//echo $str;
$preg='#最新首播.* <div class="_nav">#isU';
preg_match($preg,$str,$arr);
//print_r($arr);die;
$preg_arr='#.*<li>.*<a href="(.*)" title=".*" target=".*">.*<div class=".*">.*<h2>(.*)</h2>.*<p>(.*)</p>.*<span class=".*"><b></b></span>.*</div>.*<span><em></em><b>(.*)</b></span>.*<div class=".*"><b></b></div>.*</a>.*</li>#isU';
preg_match_all($preg_arr,$arr[0],$arr_rr);
//print_r($arr_rr);die;
foreach($arr_rr[1] as $key=>$value)
{
    $arr_gg['movie_url']=$arr_rr[1][$key];
    $arr_gg['movie_name']=$arr_rr[2][$key];
    $arr_gg['movie_jianjie']=$arr_rr[3][$key];
    $arr_gg['movie_score']=$arr_rr[4][$key];
    $dbh=new PDO('mysql:host=localhost;dbname=gaofei','root','root');
    $sql="insert into movie(movie_url,movie_name,movie_jianjie,movie_score) VALUES('{$arr_gg['movie_url']}','{$arr_gg['movie_name']}','{$arr_gg['movie_jianjie']}','{$arr_gg['movie_score']}')";
    $dbh->exec($sql);


}



